<?php
// +----------------------------------------------------------------------
// | 知识星球[基于ThinkPHP5开发]
// +----------------------------------------------------------------------
// | Copyright (c) 2018-2019 abcblockchain.io
// +----------------------------------------------------------------------
// | 后台管理使用了HisiPHP
// +----------------------------------------------------------------------
// | Author: abcblockchain.io
// +----------------------------------------------------------------------
namespace app\common\model;

use think\Model;
use think\Db;

/**
 * 资金日志模型
 * @package app\common\model
 */
class CurrencyLog extends Model
{
    // 定义时间戳字段名
    protected $createTime = 'ctime';
    protected $updateTime = false;

    // 自动写入时间戳
    protected $autoWriteTimestamp = true;


    /**
     * 插入资金日志
     * @author
     * @param $userId
     * @param $currencyId
     * @param $num
     * @param $optionType
     * @param $numType
     * @return bool
     */
    public function insertCurrencyLog($userId, $currencyId, $num, $optionType, $numType)
    {
        $map = [];
        $map['user_id'] = $userId;
        $map['currency_id'] = $currencyId;
        $map['num'] = $num;
        $map['option_type'] = $optionType;
        $map['num_type'] = $numType;
        $map['ctime'] = time();
        $res = $this->insertGetId($map);
        if (!$res) {
            return false;
        } else {
            return true;
        }
    }



}